The following is a general-purpose handler to simulate a common button behavior.
We assume that each button has three pieces of artwork associated with it, in three successive castmember slots: first is the default button, then the hilit (rollover) button, then the clicked
(depressed) button. The Handler can be called from a Frame Script, with a different action associated with each sprite. These actions are scripted as a single string. Example Frame Script:
>> if rollover(1) then FlashRoller 1, "go to frame 10"
>> if rollover(2) then FlashRoller 2, "play movie " "E& "My Drive:More Movies:NewMovie"
"E
>> if rollover(4) then FlashRoller 4, "set the stageColor to random(256)" &RETURN&
"updateStage" &RETURN& "MySpecialHandler"
>> go the frame
The handler itself, defined in the Movie Script, has extensive testing for rolloffs and mouseups:
>> on FlashRoller whichChannel, scriptToExecute
>> set myCast = the mouseCast
>> set flag = 0
>> set the castNum of sprite whichChannel = myCast + 1
>> updateStage
>> repeat while rollover(whichChannel)
>> if the mouseDown then
>> set the castNum of sprite whichChannel = myCast + 2
>> updateStage
>> repeat while the mouseDown
>> if not rollover(whichChannel) then exit repeat
>> end repeat
>> if rollover(whichChannel) then set flag = 1
>> exit repeat
>> end if
>> end repeat
>> set the castNum of sprite whichChannel = myCast
>> updateStage
>> if flag then do scriptToExecute
>> end FlashRoller
--A number of people have asked me
--by Email how to make a QT movie
--run like a demon in MacDirector 4.
--The following can be gleaned from
--Director 4 Tips & Tricks, p.16
--
-- * Try this LINGO for playing a QT movie in channel 1 *
--
--on exitFrame
-- global gMoovLength
-- set gMoovLength=the duration of cast (the castNum of sprite 1)
--end
--
--* :in the following frame:*
--
--on exitFrame
-- repeat while the movieRate of
-- sprite 1
-- updateStage
-- end repeat
--end
--
-- * be sure and set the movie to play
--Direct to Stage, play every frame,
-- in the Cast Movie radio button if
--no QT sound is used*
--You can still play a looped sound in
--one of the sound channels, or use a puppetSound.
--Make a projector, and be sure to give it enough RAM in the get info